<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 累加:逐步求和  1+2+3+4+。。。+100    sum=0  sum+=i 
        //               1*2*3*4*...*100      sum=1     sum*=i

        var y = +prompt('年');
        var m = +prompt('月');
        var d = +prompt('天');
        // 2023  12  31      31+er+31+30+31+...   累计求和  sum



        // 此处省略日期的判断
        var sum = 0;
        switch (m) {
            case 12: sum += 30;
            case 11: sum += 31;
            case 10: sum += 30;
            case 9: sum += 31;
            case 8: sum += 31;
            case 7: sum += 30;
            case 6: sum += 31;
            case 5: sum += 30;
            case 4: sum += 31;
            case 3: sum += 28;
            // if(y % 4 === 0 && y % 100 !== 0 || y % 400 === 0) {
            //     sum += 29 ;
            // } else {
            //     sum += 28 ;
            // }
            // sum += y % 4 === 0 && y % 100 !== 0 || y % 400 === 0 ? 29 : 28 ;
            case 2: sum += 31;
            case 1: sum += d;
        }



        if (y % 4 === 0 && y % 100 !== 0 || y % 400 === 0 && m > 2) {
            sum += 1;
        }

        alert(sum)




    </script>

</body>

</html>